// Attaque !
			if (Q.inputs['fire'] && Date.now() - this.last_shot > 500) {
				var from, to, angle, sword, tmp_distance, distance = -1, nearest_ennemy = -1;
				var killables = Q("Ennemy");
				// On met à jour la date du tir
				this.last_shot = Date.now();
				// On ajoute une nouvelle épée
				sword = Q.stage(0).insert(new Q.Sword({asset : "sword.png", x: -10, y: -10}));
				// On parcours les ennemis pour voir s'il y en a un à viser
				for(var i=0; i < killables.length; i++) {
					tmp_distance = Math.sqrt(Math.pow(this.p.x - killables.items[i].p.x, 2) + Math.pow(this.p.y - killables.items[i].p.y, 2));
					if (distance == -1 || tmp_distance < distance) {
						distance = tmp_distance;
						nearest_ennemy = i;
					}
				}
				// Si il y en a un on choisit celui là comme destination
				if (nearest_ennemy != -1) {
					to = {x: killables.items[nearest_ennemy].p.x, y: killables.items[nearest_ennemy].p.y};
				} else {
					to = {x: this.p.x+10, y: this.p.y}
				}
				// Le calcul de l'angle
				from = {x: this.p.x, y: this.p.y};
				angle = Math.atan2(from.y - to.y, from.x - to.x);
				// On place l'épée et on la lance
				sword.p.x = from.x;
				sword.p.y = from.y;
				sword.p.vy = -1*Math.round(Math.sin(angle) * 175);
				sword.p.vx = -1*Math.round(Math.cos(angle) * 175);
			}



			if (Date.now() - this.last_shot > 750) {
				var from, to, angle, sword, tmp_distance;
				// On met à jour la date du tir
				this.last_shot = Date.now();
				// On ajoute une nouvelle épée
				sword = Q.stage(0).insert(new Q.Sword({ennemy: 'Player', asset : "sword.png", x: -10, y: -10}));
				// On identifie le player
				var player = Q("Player").first();
				to = {x: player.p.x, y: player.p.y};
				// Le calcul de l'angle
				from = {x: this.p.x, y: this.p.y};
				angle = Math.atan2(from.y - to.y, from.x - to.x);
				// On place l'épée et on la lance
				sword.p.x = from.x;
				sword.p.y = from.y;
				sword.p.vy = -1*Math.round(Math.sin(angle) * 175);
				sword.p.vx = -1*Math.round(Math.cos(angle) * 175);
			}




				// Une arme
	Q.Sprite.extend("Sword",{
		init: function(p) {
			if (p.ennemy == 'Player') {
				var cm = Q.SPRITE_ALL & ~Q.SPRITE_ENEMY;
				var t = Q.SPRITE_PLAYER_SHOT;
			} else {
				p.ennemy = 'Ennemy';
				var cm = Q.SPRITE_ALL & ~Q.SPRITE_PLAYER;
				var t = Q.SPRITE_ENEMY_SHOT;
			}
			this._super(p, {gravity:0, type: t, collisionMask: cm });
			this.add('2d');
			this.on("hit",function(collision) {
				if(collision.obj.isA(this.p.ennemy)) {
					collision.obj.destroy();
					this.destroy();
				} else {
					this.destroy();
				}
			});
		}

	});












	,
				type: Q.SPRITE_PLAYER,
				collisionMask: (Q.SPRITE_DEFAULT | Q.SPRITE_ACTIVE) & ~Q.SPRITE_PLAYER_SHOT



				type: Q.SPRITE_ENEMY,
				collisionMask: (Q.SPRITE_DEFAULT | Q.SPRITE_ACTIVE) & ~Q.SPRITE_ENEMY_SHOT


